/*
 * File.h
 *
 *  Created on: 14/11/2011
 *      Author: marcio
 */

#ifndef FILE_H_
#define FILE_H_

#include <stdio.h>

typedef enum filepermissionEnum{
	FILE_WRITE,
	FILE_READ,
	FILE_READ_AND_WRITE,
	FILE_OVERWRITE,
	FILE_READ_AND_OVERWRITE
}filepermission;


typedef struct{
	FILE* file;
	char* name;
	filepermission permission;
}File;

File* file_open(char* name , filepermission permission);

int file_readInt(File* f);

double file_readDouble(File* f);

char file_readChar(File* f);

char* file_readString(File* f, int size);

void* file_readBytes(File* f, int size);

int file_writeInt(File* f, int data);

int file_writeDouble(File* f, double data);

int file_writeChar(File* f, char data);

int file_writeString(File* f, int size, char* data);

int file_writeBytes(File* f, int size , void* data);

int file_rewind(File* f);

int file_close(File* f);

int file_delete(File* f);

#endif /* FILE_H_ */
